<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="img/ic.png">
    <title>场景详情</title>

    <!-- Bootstrap Core CSS -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="dist/css/bootstrapValidator.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="css/sb-admin.css" rel="stylesheet">

    <!-- Morris Charts CSS -->
    <link href="css/plugins/morris.css" rel="stylesheet">
    <link href="nuget/content/content/toastr.css" rel="stylesheet" type="text/css"/>
    <!-- Custom Fonts -->
    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <!-- tab table-->
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="js/cdn/html5shiv-3.7.0.js"></script>
    <script src="js/cdn/respond-1.4.2.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="css/cdn/dataTables.bootstrap.css">
    <link rel="stylesheet" href="css/cdn/font_i0327076nave7b9.css">
    <link rel="stylesheet" type="text/css" href="css/datatable.css"/>
    <style>
        #example_paginate {
            float: right;
        }

        .handle-btn {
            cursor: pointer;
            margin: 0 2px;
        }

        #wrapper {
            padding-left: 0px;
        }

        .navigation {
            border-bottom: 3px solid #edebeb;
        }

        .navigation a:hover {
            color: #0F6AFC;
            border-bottom: 2px solid #01AAED;
        }

        .this {
            color: #01aaed;
            font-weight: bold;
            border-bottom: 2px solid #01AAED;
        }

        [v-cloak] {
            display: none;
        }
    </style>
</head>

<body>

<div id="wrapper">
    <div id="page-wrapper">
        <div class="container-fluid">
            <div class="row sss">
                <nav class="navbar navbar-default" role="navigation" style="margin: 0">
                    <div>
                        <ul class="nav navbar-nav">
                            <li><a href="Fault.html">场景维护</a></li>
                            <li><a href="javascript:;"><span class="xuanzhong">场景详情</span></a></li>
                        </ul>
                    </div>
                </nav>
            </div>
            <!-- /.row -->
            <div class="row" style="padding: 0;">
                <div class="panel">
                    <div class="panel-heading" style="padding-top: 0">
                        <ul class="nav" v-cloak>
                            <li style="float: left; padding-right: 30px; line-height: 34px;">
                                <b>{{dataObj.scenesName}}</b>
                            </li>
                            <li style="float: left; line-height: 34px;">
                                总分值<span style="color: #C7254E; padding-left: 10px;">{{dataObj.scenesScore}}</span>
                            </li>
                            <li style="float: left; padding-left: 20px;">
                                <button class="btn btn-primary" type="button" data-toggle="modal"
                                        data-target="#RefereeModal">
                                    修改场景名称
                                </button>
                            </li>
                        </ul>
                    </div>
                    <div class="panel-body">
                        <div class="panel-heading">
                            <ul class="nav">
                                <li style="float: left;">
                                    <b class="panel-title" style=" line-height: 34px;"><span class="xiahua">行为记录</span></b>
                                </li>
                                 <li style="float: left; padding-left: 20px;">
                                    <button class="btn btn-primary" type="button" data-toggle="modal" data-target="#addScene">
                                        添加行为记录
                                    </button>
                                </li>
                            </ul>
                        </div>
                        <div class="panel-body">
                            <table id="example" class="display" width="100%"></table>
                        </div>
                    </div>
                    <div class="panel-body">
                        <div class="panel-heading">
                            <ul class="nav">
                                <li style="float: left;">
                                    <b class="panel-title" style=" line-height: 34px;"><span class="xiahua">技术&设备</span></b>
                                </li>
                                <li style="float: left; padding-left: 20px;">
                                    <button class="btn btn-primary" type="button" data-toggle="modal"
                                            data-target="#addEquipment">
                                        添加技术&设备
                                    </button>
                                </li>
                            </ul>
                        </div>
                        <div class="panel-body">
                            <table id="example2" class="display" width="100%"></table>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.row -->
        </div>
        <!-- /.container-fluid -->

    </div>
    <!-- /#page-wrapper -->
    <!-- 修改记录 -->
    <div class="modal fade" id="RefereeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="panel-body">
                        <form class="form-horizontal" id="Refereeform" method="get">
                            <div class="text-center" style="line-height: 34px; margin-bottom: 5px; font-size: 16px;"><b>编辑场景名称</b>
                            </div>
                            <div class="form-group">
                                <input name="scenesId" type="hidden" :value="dataObj.scenesId"/>
                                <input id="illegalId" name="illegalId" type="hidden" :value="dataObj.illegalId"/>
                                <label class="col-sm-2 control-label">名称</label>
                                <div class="col-sm-10">
                                    <input type="text" name="scenesName" class="form-control"
                                           :value="dataObj.scenesName">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">总分值</label>
                                <div class="col-sm-10">
                                    <input type="text" name="scenesScore" class="form-control"
                                           :value="dataObj.scenesScore">
                                </div>
                            </div>
                            <div class="text-center">
                                <button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">
                                    关闭
                                </button>
                                <button type="submit" class="btn btn-primary" style="margin-left: 10px;">
                                    保存
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>

    <!-- /#wrapper -->
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="addScene" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="panel-body">
                        <form class="form-horizontal" id="scenesform" method="get">
                            <div class="text-center" style="line-height: 34px; margin-bottom: 5px; font-size: 16px;"><b>添加行为记录</b>
                            </div>
                            <input name="scenesId" type="hidden" :value="dataObj.scenesId"/>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">名称</label>
                                <div class="col-sm-10">
                                    <input type="text" name="illegalName" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">分值</label>
                                <div class="col-sm-10">
                                    <input type="text" name="illegalScore" class="form-control">
                                </div>
                            </div>
                            <div class="text-center">
                                <button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">
                                    关闭
                                </button>
                                <button type="submit" class="btn btn-primary" style="margin-left: 10px;">
                                    保存
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <!-- 技术设备维护模态框 -->
    <div class="modal fade" id="addEquipment" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="panel-body">
                        <form class="form-horizontal" id="equipform" method="get">
                            <div class="text-center" style="line-height: 34px; margin-bottom: 5px; font-size: 16px;"><b>添加设备&技术</b>
                            </div>
                            <input name="scenesId" type="hidden" :value="dataObj.scenesId"/>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">名称</label>
                                <div class="col-sm-10">
                                    <input type="text" name="equipmentName" class="form-control">
                                </div>
                            </div>
                            <div class="text-center">
                                <button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">
                                    关闭
                                </button>
                                <button type="submit" class="btn btn-primary" style="margin-left: 10px;">
                                    保存
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <!-- 修改行为记录 -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="panel-body">
                        <form class="form-horizontal" id="teamform" method="get">
                            <div class="text-center" style="line-height: 34px; margin-bottom: 5px; font-size: 16px;"><b>编辑行为记录</b>
                            </div>
                            <div class="form-group">
                                <input name="scenesId" type="hidden" :value="dataObj.scenesId"/>
                                <input id="illegalId" name="illegalId" type="hidden" :value="dataObj.illegalId"/>
                                <label class="col-sm-2 control-label">名称</label>
                                <div class="col-sm-10">
                                    <input type="text" name="illegalName" class="form-control"
                                           :value="dataObj.illegalName">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">分值</label>
                                <div class="col-sm-10">
                                    <input type="text" name="illegalScore" :value="dataObj.illegalScore"
                                           class="form-control">
                                </div>
                            </div>
                            <div class="text-center">
                                <button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">
                                    关闭
                                </button>
                                <button type="submit" class="btn btn-primary" style="margin-left: 10px;">
                                    保存
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <!-- 修改技术&设备 -->
    <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="panel-body">
                        <form class="form-horizontal" id="teamform2" method="get">
                            <div class="text-center" style="line-height: 34px; margin-bottom: 5px; font-size: 16px;"><b>编辑技术&设备</b>
                            </div>
                            <div class="form-group">
                                <input name="scenesId" type="hidden" :value="dataObj.scenesId"/>
                                <input id="equipmentId" name="equipmentId" type="hidden" :value="dataObj.equipmentId"/>
                                <label class="col-sm-2 control-label">名称</label>
                                <div class="col-sm-10">
                                    <input type="text" name="equipmentName" class="form-control"
                                           :value="dataObj.equipmentName">
                                </div>
                            </div><!--
                            <div class="form-group">
                                <label class="col-sm-2 control-label">分值</label>
                                <div class="col-sm-10">
                                    <input type="text" name="illegalScore" :value="dataObj.illegalScore"
                                           class="form-control">
                                </div>
                            </div>-->
                            <div class="text-center">
                                <button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">
                                    关闭
                                </button>
                                <button type="submit" class="btn btn-primary" style="margin-left: 10px;">
                                    保存
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <!-- /.删除行为记录 -->
    <div class="modal fade" id="Delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content" style="border-top: 5px solid #12dbcd;">
                <div class="modal-body text-center">确定要删除此项？</div>
                <div class="text-center" style="padding-bottom: 15px;">
                    <input id="illegalId" name="illegalId" type="hidden" :value="dataObj.illegalId"/>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button style="margin-left: 10px;" type="button" v-on:click="Delete()" class="btn btn-primary">确定
                    </button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    <!-- /.删除技术&设备 -->
    <div class="modal fade" id="Delete2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content" style="border-top: 5px solid #12dbcd;">
                <div class="modal-body text-center">确定要删除此项？</div>
                <div class="text-center" style="padding-bottom: 15px;">
                    <input id="equipmentId2" name="equipmentId" type="hidden" :value="dataObj.equipmentId"/>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button style="margin-left: 10px;" type="button" v-on:click="Delete2()" class="btn btn-primary">确定
                    </button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
</div>
<!-- jQuery -->
<script src="js/jquery.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- tab table-->
<script src="js/cdn/jquery.dataTables.min.js"></script>
<script src="js/cdn/dataTables.bootstrap.js"></script>
<!-- device-->
<script src="nuget/content/scripts/toastr.js"></script>
<script type="text/javascript" src="dist/js/bootstrapValidator.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/vue/vue.js"></script>
<script type="text/javascript" src="js/vue/vue-router.js"></script>
<script>
	var userName = localStorage.getItem("userName");
	$("#userName").text(userName);
	Vue.filter("timeChange", function (value) {
		return replaceTime(value / 1000);
	});
	var vue = new Vue({
		el: '#wrapper',
		data: {
			dataObj: {
				teamPhone: '',
				teamName: '',
				teamOrganization: '',
				teamLeader: ''
			},
			Validator: {
				message: 'This value is not valid',
				feedbackIcons: {
					valid: 'glyphicon glyphicon-ok',
					invalid: 'glyphicon glyphicon-remove',
					validating: 'glyphicon glyphicon-refresh'
				},
				fields: {
					scenesName: {
						validators: {
							notEmpty: {
								message: '场景名称不能为空'
							},
						}
					},
					illegalName: {
						validators: {
							notEmpty: {
								message: '行为记录名不能为空'
							},
						}
					},
					illegalScore: {
						validators: {
							notEmpty: {
								message: '成绩不能为空'
							},
							regexp: {
								regexp: /^[0-9]*$/,
								message: '输入有效的成绩'
							}
						}
					},
				}
			},
		},
		mounted: function () {
			this.deviceBasicId();
			this.deviceBasicId2();
			this.Initialization();
			this.form();
		},
		methods: {
			form: function () {
				$("#Refereeform").bootstrapValidator(
					this.Validator
				).on("success.form.bv", function () {
					vue.RefereeModal();
				});
				$("#scenesform").bootstrapValidator(
					this.Validator
				).on("success.form.bv", function () {
					vue.addScene();
				});
				$("#equipform").bootstrapValidator(
					this.Validator
				).on("success.form.bv", function () {
					vue.addEquip();
				});
				$("#teamform").bootstrapValidator(
					this.Validator
				).on("success.form.bv", function () {
					vue.Submit();
				});
				$("#teamform2").bootstrapValidator(
					this.Validator
				).on("success.form.bv", function () {
					vue.Submit2();
				});
			},

            //初始化设备的
            deviceBasicId2: function () {
                var _self = this;
                $(document).ready(function () {
                    var myTable = $('#example2').DataTable({
                        "processing": false, //DataTables载入数据时，是否显示‘进度’提示
                        "stateSave": true, //是否打开客户端状态记录功能,此功能在ajax刷新纪录的时候不会将个性化设定回复为初始化状态
                        "scrollCollapse": true, //是否开启DataTables的高度自适应，当数据条数不够分页数据条数的时候，插件高度是否随数据条数而改变
                        "paginationType": "full_numbers", //详细分页组，可以支持直接跳转到某页
                        "language": lang, //提示信息
                        "destroy": true,//Cannot reinitialise DataTable,解决重新加载表格内容问题
                        "autoWidth": true, //自适应宽度，
                        "lengthMenu": [8, 30, 50],
                        "stripeClasses": ["odd", "even"], //为奇偶行加上样式，兼容不支持CSS伪类的场合
                        "showRowNumber": true,
                        "searching": false, //是否允许Datatables开启本地搜索
                        "paging": false, //是否开启本地分页
                        "lengthChange": false, //是否允许产品改变表格每页显示的记录数
                        "info": false, //控制是否显示表格左下角的信息
                        //跟数组下标一样，第一列从0开始，这里表格初始化时，第四列默认降序
                        "ordering": false,
                        "deferRender": true, //延迟渲染
                        "bSortClasses": true,
                        //"ajax":"json/device.json",
                        "ajax": {
                            url: url + '/users/' + adminId + '/scenes/' + scenesId + '/detail1',
                            type: 'get',
                            data: {
                                "currentPage": 1,
                                "pageSize": 9999,
                            },
                            dataType: 'json',
                            beforeSend: function (request) {
                                request.setRequestHeader("accessToken", accessToken);
                            },
                            success: function (data) {
                                console.log(data);
                                if (data['code'] == 1) {
                                    if (data.result.equipmentInfoList.length != 0)
                                        $('#example2').dataTable().fnAddData(data.result.equipmentInfoList);
                                    else
                                        $('#example2').dataTable().fnClearTable();
                                }
                            }
                        }, //数据的路径 "http://192.168.5.133:8081/ic-iot/admin/'+adminId+'/devices" /"json/device.json"

                        "columns": [{ //定义列
                            "data": "riwso",
                            "width": "50px",
                            "render": function (data, type, full, meta) {
                                return (meta.row + 1);
                            },
                            "sTitle": "序号", //标题
                            "sDefaultContent": "", //此列默认值为""，以防数据中没有此值，DataTables加载数据的时候报错
                        }, {
                            "data": "equipmentName",
                            "sTitle": "设备名称",
                            "sDefaultContent": "",
                        }, {
                            "data": function (obj) {
                                var equipmentId = obj.equipmentId;
                                return '<span  title="编辑" class="handle-btn handle-btn-edit"  data-toggle="modal" data-target="#myModal2" onclick=javascript:vue.team2(' + equipmentId + ');><b class="iconfont icon-xiangqing" style="color:#ffbe00"></b></span><span  title="删除" data-toggle="modal" data-target="#Delete2" onclick=javascript:vue.team2(' + equipmentId + '); class="handle-btn handle-btn-edit"><b class="iconfont icon-shanchu" style="color:#ffbe00"></b></span>';
                            },
                            "className": "td-handle",//data-user='+teid+'  id="test'+teid+'"
                            "sTitle": "操作", //标题
                            "width": "80px",
                            "sDefaultContent": "", //此列默认值为""，以防数据中没有此值，DataTables加载数据的时候报错  onclick=javascript:team('+teamId+');
                        }],
                    });
                });
            },

			//初始化行为记录
			deviceBasicId: function () {
				var _self = this;
				$(document).ready(function (){
					var myTable = $('#example').DataTable({
						"processing": false, //DataTables载入数据时，是否显示‘进度’提示
						"stateSave": true, //是否打开客户端状态记录功能,此功能在ajax刷新纪录的时候不会将个性化设定回复为初始化状态
						"scrollCollapse": true, //是否开启DataTables的高度自适应，当数据条数不够分页数据条数的时候，插件高度是否随数据条数而改变
						"paginationType": "full_numbers", //详细分页组，可以支持直接跳转到某页
						"language": lang, //提示信息
						"destroy": true,//Cannot reinitialise DataTable,解决重新加载表格内容问题
						"autoWidth": true, //自适应宽度，
						"lengthMenu": [8, 30, 50],
						"stripeClasses": ["odd", "even"], //为奇偶行加上样式，兼容不支持CSS伪类的场合
						"showRowNumber": true,
						"searching": false, //是否允许Datatables开启本地搜索
						"paging": false, //是否开启本地分页
						"lengthChange": false, //是否允许产品改变表格每页显示的记录数
						"info": false, //控制是否显示表格左下角的信息
						//跟数组下标一样，第一列从0开始，这里表格初始化时，第四列默认降序
						"ordering": false,
						"deferRender": true, //延迟渲染
						"bSortClasses": true,
						//"ajax":"json/device.json",
						"ajax": {
							url: url + '/users/' + adminId + '/scenes/' + scenesId + '/detail',
							type: 'get',
							data: {
								"currentPage": 1,
								"pageSize": 9999,
							},
							dataType: 'json',
							beforeSend: function (request) {
								request.setRequestHeader("accessToken", accessToken);
							},
							success: function (data) {
								console.log(data);
								if (data['code'] == 1) {
									if (data.result.illegalInfoList.length != 0)
										$('#example').dataTable().fnAddData(data.result.illegalInfoList);
									else
										$('#example').dataTable().fnClearTable();
								}
							}
						}, //数据的路径 "http://192.168.5.133:8081/ic-iot/admin/'+adminId+'/devices" /"json/device.json"



						"columns": [{ //定义列
							"data": "riwso",
							"width": "50px",
							"render": function (data, type, full, meta) {
								return (meta.row + 1);
							},
							"sTitle": "序号", //标题
							"sDefaultContent": "", //此列默认值为""，以防数据中没有此值，DataTables加载数据的时候报错
						}, {
							"data": "illegalName",
							"sTitle": "违章行为记录",
							"sDefaultContent": "",
						}, {
							"data": function (obj) {
								return obj.illegalScore + '分';
							},
							"sTitle": "分值",
							"sDefaultContent": "",
						}, {
							"data": function (obj) {
								var illegalId = obj.illegalId;
								return '<span  title="编辑" class="handle-btn handle-btn-edit"  data-toggle="modal" data-target="#myModal" onclick=javascript:vue.team(' + illegalId + ');><b class="iconfont icon-xiangqing" style="color:#ffbe00"></b></span><span  title="删除" data-toggle="modal" data-target="#Delete" onclick=javascript:vue.team(' + illegalId + '); class="handle-btn handle-btn-edit"><b class="iconfont icon-shanchu" style="color:#ffbe00"></b></span>';
							},
							"className": "td-handle",//data-user='+teid+'  id="test'+teid+'"
							"sTitle": "操作", //标题
							"width": "80px",
							"sDefaultContent": "", //此列默认值为""，以防数据中没有此值，DataTables加载数据的时候报错  onclick=javascript:team('+teamId+');
						}],
					});
				});
			},

			team: function (illegalId) {
				var _self = this;
				$.ajax({
					type: "get",
					url: url + '/users/' + adminId + '/illegal/' + illegalId,
					async: false,
					dataType: 'json',
					contentType: "application/json; charset=utf-8",
					beforeSend: function (request) {
						request.setRequestHeader("accessToken", accessToken);
					},
					success: function (data) {
						console.log(data);
						if (data.code == 1) {
							_self.dataObj = {};
							var result = data.result;
							_self.dataObj = result;
						} else {
							toastr['error'](data.description);
						}
					}
				});
			},
            //修改技术设备
            team2:function (equipmentId) {
				var _self = this;
				$.ajax({
					type: "get",
					url: url + '/users/' + adminId + '/equipment/' + equipmentId,
					async: false,
					dataType: 'json',
					contentType: "application/json; charset=utf-8",
					beforeSend: function (request) {
						request.setRequestHeader("accessToken", accessToken);
					},
					success: function (data) {
						console.log(data);
						if (data.code == 1) {
							_self.dataObj = {};
							var result = data.result;
							_self.dataObj = result;
						} else {
							toastr['error'](data.description);
						}
					}
				});
			},
            //修改场景名称
			RefereeModal: function () {
				var datas = formToJson($("#Refereeform"));
				var th = this;
				$.ajax({
					type: "PUT",
					url: url + '/users/' + adminId + '/scenes/' + scenesId,
					data: datas,
					async: false,
					dataType: 'json',
					contentType: "application/json; charset=utf-8",
					beforeSend: function (request) {
						request.setRequestHeader("accessToken", accessToken);
					},
					success: function (data) {

						//th.deviceBasicId();//刷新
						if (data.code == 1) {
							$('#myModal').modal('hide');
							location.reload();
						} else {
							toastr['error'](data.description);
						}
					}
				});
			},
			//添加
			addScene: function () {
				var datas = formToJson($("#scenesform"));
				var th = this;
				$.ajax({
					type: "post",
					url: url + '/users/' + adminId + '/illegal',
					data: datas,
					async: false,
					dataType: 'json',
					contentType: "application/json; charset=utf-8",
					beforeSend: function (request) {
						request.setRequestHeader("accessToken", accessToken);
					},
					success: function (data) {

						if (data.code == 1) {
							$('#addScene').modal('hide');
							location.reload();
							th.deviceBasicId();//刷新
						} else {
							toastr['error'](data.description);
						}
					}
				});
			},
			//添加技术&设备
			addEquip: function () {
				var datas = formToJson($("#equipform"));
				var th = this;
				$.ajax({
					type: "post",
					url: url + '/users/' + adminId + '/equipment',
					data: datas,
					async: false,
					dataType: 'json',
					contentType: "application/json; charset=utf-8",
					beforeSend: function (request) {
						request.setRequestHeader("accessToken", accessToken);
					},
					success: function (data) {

						if (data.code == 1) {
							$('#addEquipment').modal('hide');
							location.reload();
							th.deviceBasicId2();//刷新
						} else {
							toastr['error'](data.description);
						}
					}
				});
			},
			//点击修改行为记录
			Submit: function () {
				var illegalId = $("#illegalId").val();
				var datas = formToJson($("#teamform"));
				var th = this;
				$.ajax({
					type: "PUT",
					url: url + '/users/' + adminId + '/illegal/' + illegalId,
					data: datas,
					async: false,
					dataType: 'json',
					contentType: "application/json; charset=utf-8",
					beforeSend: function (request) {
						request.setRequestHeader("accessToken", accessToken);
					},
					success: function (data) {
						if (data.code == 1) {
							$('#myModal').modal('hide');
							location.reload();
						} else {
							toastr['error'](data.description);
						}

						//th.deviceBasicId();//刷新
					}
				});
			},
			//点击修改技术&设备
			Submit2: function () {
				var equipmentId = $("#equipmentId").val();
				var datas = formToJson($("#teamform2"));
				var th = this;
				$.ajax({
					type: "PUT",
					url: url + '/users/' + adminId + '/equipment/' + equipmentId,
					data: datas,
					async: false,
					dataType: 'json',
					contentType: "application/json; charset=utf-8",
					beforeSend: function (request) {
						request.setRequestHeader("accessToken", accessToken);
					},
					success: function (data) {
						if (data.code == 1) {
							$('#myModal2').modal('hide');
							location.reload();
						} else {
							toastr['error'](data.description);
						}

						//th.deviceBasicId();//刷新
					}
				});
			},
			//初始化
			Initialization: function () {
				var _self = this;
				$.ajax({
					type: "get",
					url: url + '/users/' + adminId + '/scenes/' + scenesId + '/detail',
					async: false,
					dataType: 'json',
					contentType: "application/json; charset=utf-8",
					beforeSend: function (request) {
						request.setRequestHeader("accessToken", accessToken);
					},
					success: function (data) {

						if (data.code == 1) {
							_self.dataObj = {};
							var result = data.result;
							_self.dataObj = result;
						} else {
							window.location.href = "404.html";
						}
					}
				});
			},
			//删除行为记录
			Delete: function () {
				var illegalId = $("#illegalId").val();
				var th = this;
				$.ajax({
					type: "DELETE",
					url: url + '/users/' + adminId + '/illegal/' + illegalId,
					async: false,
					dataType: 'json',
					contentType: "application/json; charset=utf-8",
					beforeSend: function (request) {
						request.setRequestHeader("accessToken", accessToken);
					},
					success: function (data) {

						if (data.code == 1) {
							$('#Delete').modal('hide');
							location.reload();
						} else {
							toastr['error'](data.description);
						}
					}
				});
			},
			//删除技术&设备
			Delete2: function () {
				var equipmentId = $("#equipmentId2").val();
				var th = this;
				console.log(url + '/users/' + adminId + '/equipment/' + equipmentId);
				$.ajax({
					type: "DELETE",
					url: url + '/users/' + adminId + '/equipment/' + equipmentId,
					async: false,
					//dataType: 'json',
					contentType: "application/json; charset=utf-8",
					beforeSend: function (request) {
						request.setRequestHeader("accessToken", accessToken);
					},
					success: function (data) {
						console.log(data);
						if (data.code == 0) {
							$('#Delete2').modal('hide');
							location.reload();
						} else {
							toastr['error'](data.description);
						}
					}
				});
			},
		},
	});
</script>
</body>

</html>
